<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>关键字列表</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.1.min.js" ></script>
</head>
<body>
<center>
<table>
	<tr>
		<td>序号</td>
		<td>关键字</td>
		<td>起价</td>
		<td>竞价模式/竞价价格</td>
		<td>竞价价格</td>
		<td>竟前三</td>
		<td>质量度</td>
		<td>当前前三名价格</td>
		<td>竞价</td>
	</tr>
	<c:forEach items="${list}" var="sell">
	<tr>
		<td id="id">${sell.sid}</td>
		<td>${sell.sName}</td>
		<td>${sell.sDepict}</td>
		<td>${sell.sPlprice}</td>
		<td><input type="text" name="price" id="price" ></td>
		<td id="ftot">${sell.sftot}</td>
		<td>${sell.sQuality}</td>
		<td>${sell.sThprice}</td>
		<td><button id="btn" onclick="jingjia(this)">竞价</button></td>
	</tr>
	</c:forEach>
</table>
</center>
<script type="text/javascript">
	$(function() {
		
		var users = new Array(); 
		$("[id='ftot']").each(function(){ 
			users.push($(this).text());
		});
		
	});

	function jingjia(btn) {

		var price =$(btn).parents("tr").find("#price").val();
		var id =$(btn).parents("tr").find("#id").text();
 		$.ajax({
			type:"post",
			url:"update",
			data:"price="+price+"&"+"sid="+id,
			datatype:"json",
			success:function(msg){
					if(msg.sta == 1){
						window.location.reload();
						}
				}
			});
	}

</script>
</body>
</html>